// SCSS variables are information about icon's compiled state, stored under its original file name
//
// .icon-home {
//   width: $icon-home-width;
// }
//
// The large array-like variables contain all information about a single icon
// $icon-home: x y offset_x offset_y width height total_width total_height image_path;
//
// At the bottom of this section, we provide information about the spritesheet itself
// $spritesheet: width height image $spritesheet-sprites;
$icon-user-qq-name: 'icon_user_qq';
$icon-user-qq-x: 0px;
$icon-user-qq-y: 0px;
$icon-user-qq-offset-x: 0px;
$icon-user-qq-offset-y: 0px;
$icon-user-qq-width: 16px;
$icon-user-qq-height: 16px;
$icon-user-qq-total-width: 36px;
$icon-user-qq-total-height: 16px;
$icon-user-qq-image: '../../images/default/sprite.user.png';
$icon-user-qq: (0px, 0px, 0px, 0px, 16px, 16px, 36px, 16px, '../../images/default/sprite.user.png', 'icon_user_qq', );
$icon-user-sina-name: 'icon_user_sina';
$icon-user-sina-x: 20px;
$icon-user-sina-y: 0px;
$icon-user-sina-offset-x: -20px;
$icon-user-sina-offset-y: 0px;
$icon-user-sina-width: 16px;
$icon-user-sina-height: 16px;
$icon-user-sina-total-width: 36px;
$icon-user-sina-total-height: 16px;
$icon-user-sina-image: '../../images/default/sprite.user.png';
$icon-user-sina: (20px, 0px, -20px, 0px, 16px, 16px, 36px, 16px, '../../images/default/sprite.user.png', 'icon_user_sina', );
$spritesheet-width: 36px;
$spritesheet-height: 16px;
$spritesheet-image: '../../images/default/sprite.user.png';
$spritesheet-sprites: ($icon-user-qq, $icon-user-sina, );
$spritesheet: (36px, 16px, '../../images/default/sprite.user.png', $spritesheet-sprites, );

// The provided mixins are intended to be used with the array-like variables
//
// .icon-home {
//   @include sprite-width($icon-home);
// }
//
// .icon-email {
//   @include sprite($icon-email);
// }
//
// Example usage in HTML:
//
// `display: block` sprite:
// <div class="icon-home"></div>
//
// To change `display` (e.g. `display: inline-block;`), we suggest using a common CSS class:
//
// // CSS
// .icon {
//   display: inline-block;
// }
//
// // HTML
// <i class="icon icon-home"></i>
@mixin sprite-width($sprite) {
  width: nth($sprite, 5);
}

@mixin sprite-height($sprite) {
  height: nth($sprite, 6);
}

@mixin sprite-position($sprite) {
  $sprite-offset-x: nth($sprite, 3);
  $sprite-offset-y: nth($sprite, 4);
  background-position: $sprite-offset-x  $sprite-offset-y;
}

@mixin sprite-image($sprite) {
  $sprite-image: nth($sprite, 9);
  background-image: url(#{$sprite-image});
}

@mixin sprite($sprite) {
  @include sprite-image($sprite);
  @include sprite-position($sprite);
  @include sprite-width($sprite);
  @include sprite-height($sprite);
}

// The `sprites` mixin generates identical output to the CSS template
//   but can be overridden inside of SCSS
//
// @include sprites($spritesheet-sprites);
@mixin sprites($sprites) {
  @each $sprite in $sprites {
    $sprite-name: nth($sprite, 10);
    .#{$sprite-name} {
      @include sprite($sprite);
    }
  }
}
